#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read()
{
	int res=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){res=(res<<1)+(res<<3)+(c^48);c=getchar();}
	return res*f;
}
void write(int x)
{
	if(x<0)putchar('-'),x=-x;
	if(x>9)write(x/10);
	putchar(x%10+'0');
}
const int mod=1e9+7;
inline int ksm(int x,int p=mod-2){int res=1;for(;p;p>>=1,x=x*x%mod)if(p&1)res=res*x%mod;return res;}
int n,m;
int a[1000005];
int ans=0;
void dfs(int st)
{
	if(st>m)
	{
		for(int i=1;i<=n-m;i++) ans=(ans+a[i])%mod;
		return;
	}
	for(int i=1;i<=n-st;i++)
	{
		int w=a[i+1];
		a[i]-=a[i+1];
		for(int j=i+1;j<=n-st;j++) a[j]=a[j+1];
		dfs(st+1);
		a[i]+=w;
		for(int j=n-st+1;j>i+1;j--) a[j]=a[j-1];
		a[i+1]=w; 
	}
}
signed main()
{
	freopen("game.in","r",stdin);
	freopen("game.out","w",stdout);
	n=read(),m=read();
	for(int i=1;i<=n;i++) a[i]=read();
	int s=1;
	for(int i=1;i<=m;i++) s=s*(n-i)%mod;
	dfs(1);
	cout<<ans<<endl;
	write(ans*ksm(s)%mod);
	return 0;
}
/*
7 6
7 6 5 4 3 2 1
*/
